package xx.observer.design;

/**
 * @Classname ConcreteObserver
 * @Description TODO
 * @Date 2023/7/25 14:37
 * @Created by wangxianlin
 */
public class ConcreteObserver implements Observer {

    private int state;

    @Override
    public void update(Subject subject) {
        if (subject instanceof ConcreteSubject) {
            state = ((ConcreteSubject) subject).getState();
            System.out.println("State changed to " + state);
        }
    }
}
